<?php
function google_map_location_options_edit($lid){
  module_load_include('inc', 'google_map_location','google_map_location');
  $location = load_gmap_get_location($lid);
  return drupal_get_form('google_map_location_enterprise_options_setting_edit_form',$location);
}
function google_map_location_enterprise_options_setting_edit_form(&$form_state, $location) {
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Title'),
    '#maxlength' => 255,
	'#default_value' => $location['title'],
    '#required' => TRUE,
  );
  $form['x'] = array(
    '#type' => 'textfield',
    '#title' => t('x'),
    '#maxlength' => 64,
    '#default_value' => $location['x'],
    '#required' => TRUE,
	/*'#attributes' => array('readonly' => 'readonly'),*/
  );
  $form['y'] = array(
    '#type' => 'textfield',
    '#title' => t('y'),
    '#maxlength' => 64,
    '#default_value' => $location['y'],
    '#required' => TRUE,
	/*'#attributes' => array('readonly' => 'readonly'),*/
  );
  $form['status'] = array(
    '#type' => 'checkbox',
    '#title' => t('status'),
    '#default_value' => $location['status'],
	/*'#attributes' => array('readonly' => 'readonly'),*/
  );
  $form['content'] = array(
    '#type' => 'textarea',
    '#title' => t('content'),
    '#maxlength' => 1024,
    '#required' => TRUE,
    '#default_value' => $location['content'],
  );
  $form['format'] = filter_form();
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Edit'),
    
  );
  $form['lid'] = array('#type' => 'hidden', '#value' => $location['lid']);
  module_load_include('inc', 'google_map_location','google_map_location');
  $options = array(
   'key' =>variable_get('GOOGLE_KEY',GOOGLE_KEY),
   'center_x' => $location['x'],
   'center_y' => $location['y'],
   'map_width' => variable_get('GOOGLE_MAP_WIDTH',GOOGLE_MAP_WIDTH),
   'map_height' => variable_get('GOOGLE_MAP_HEIGTH',GOOGLE_MAP_HEIGTH),
   'zoom' => variable_get('GOOGLE_ZOOM',GOOGLE_ZOOM),
   'items' => array($location),
   'id_google_map_location_add_x' =>'edit-x',
   'id_google_map_location_add_y' =>'edit-y',
   );
  $form['google_map'] = array(
    '#value' => theme('google_map_location_add', $options),
  );
  return $form;
}
function google_map_location_enterprise_options_setting_edit_form_submit($form, &$form_state) {
  module_load_include('inc', 'google_map_location','google_map_location');
  $form_values = $form_state['values'];
  edit_location($form_values['lid'],$form_values['title'],
    $form_values['x'],
    $form_values['y'],
    $form_values['content'],
	$form_values['status']);
}
?>